<?php
$this->headTitle('Quản Lý Tin Rao Bán, Cho Thuê', 'append');
?>
<div class="dashboard-menu dashboard-admin">
    <span class="back">&nbsp;</span>
    <h1>Bán/Thuê</h1>
    <?php if($this->acl->checkResource($this->auth,'admin','adsfor','add')){ ?>
        <a class="btn btn-danger" href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'adsfor', 'action'=>'add'));?>">
            Thêm mới
        </a>
    <?php } ?>
</div>

<div class="row placeholders">
    <div class="col-md-12">
        <div class="widget-big">
            <div class="table table-responsive">
                <div class="search-result text-left">
                    <table class="table table-bordetext-danger table-striped table-condensed table-hover" border="0" cellspacing="0" cellpadding="0">
                        <thead>
                            <tr class="warning">
                                <th>ID</th>
                                <th>Tiêu Đề</th>
                                <th>Ngày Đăng Tin</th>
                                <th>Ngày Bắt Đầu</th>
                                <th>Ngày Kết Thúc</th>
                                <th>Loại Giao Dịch</th>
                                <th>Loại Bất Động Sản</th>
                                <th>Dự Án</th>
                                <th>Diện Tích</th>
                                <th>Tổng Tiền</th>
                                <th>Người Liên Hệ</th>
                                <th>Địa Chỉ</th>
                                <th>Mobile</th>
                                <th>Status</th>
                                <th>Action</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php 
                                foreach ($this->forList as $for){
                            ?>
                            <tr>
                                <td><?php echo $for['id'];?></td>
                                <td>
                                    <?php  if($this->acl->checkResource($this->auth,'admin','adsfor','detail')){ ?>
                                        <a href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'adsfor', 'action'=>'detail', 'id'=>$for['id']));?>" title="Sửa thông tin rao vặt">
                                            <?php echo $for['title']; ?>
                                        </a>
                                    <?php }else{ ?>
                                        <span class="blue"><?php echo $for['title']; ?></span>
                                    <?php } ?>
                                </td>
                                <td><?php echo date("Y-m-d", $for['createDate']);?></td>
                                <td><?php echo date("Y-m-d", $for['startDate']);?></td>
                                <td><?php echo date("Y-m-d", $for['endDate']);?></td>
                                <td>
                                    <?php
                                        if($for['transaction'] == 1){
                                            echo 'Cho Thuê';
                                        }elseif($for['transaction'] == 0){
                                            echo 'Bán';
                                        }
                                    ?>
                                </td>
                                <td><?php echo $for['estateName'];?></td>
                                <td>
                                    <?php
                                        if(isset($for['projectName']) && $for['projectName']){
                                            echo "{$for['projectName']}";
                                        }else{
                                            echo '<span class="active glyphicon glyphicon-minus" title="Null"></span>';
                                        }
                                    ?>
                                </td>
                                <td><?php echo $for['area'];?></td>
                                <td><?php echo $for['total'];?></td>
                                <td><?php echo $for['contact'];?></td>
                                <td><?php echo $for['address'];?></td>
                                <td><?php echo $for['mobile'];?></td>
                                <td>
                                    <?php
                                        if($for['status'] == 1){
                                            echo '<span class="active glyphicon glyphicon-ok" title="Enable"></span>';
                                        }else{
                                            echo '<span class="active glyphicon glyphicon-minus" title="Disable"></span>';
                                        }
                                    ?>
                                </td>
                                <td>
                                    
                                    <?php 
                                        
                                        if($this->acl->checkResource($this->auth,'admin','adsfor','edit')){ ?>
                                        <a class="glyphicon glyphicon-pencil" href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'adsfor', 'action'=>'edit', 'id'=>$for['id']));?>" title="Sửa thông tin">
                                        </a>&nbsp;&nbsp;
                                    <?php 
                                        }
                                        if($this->acl->checkResource($this->auth,'admin','adsfor','delete')){ 
                                    ?>
                            			<a class="glyphicon glyphicon-remove" href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'adsfor', 'action'=>'delete', 'id'=>$for['id']));?>" title="Xóa">
                                        </a>
                                    <?php 
                                        }
                                        if($this->acl->checkResource($this->auth,'admin','adsfor','detail')){  
                                    ?>
                                        <a class="glyphicon glyphicon-list-alt" href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'adsfor', 'action'=>'detail', 'id'=>$for['id']));?>" title="Xem chi tiết">
                                        </a>
                                    <?php 
                                        }
                                     
                                    ?>
                                </td>
                            </tr>
                            <?php
                                } 
                            ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>